<?php
?>

<html>
    <head>
        <title>Wikked Paste</title>
    </head>
    <body>
        <?php
            require ( "../config/database.php" );
            require ( "database.php");
            require_once("auth.php");
            if ( !isset ( $_POST ['input_contents'] ) ) die ( "Input text is not set!" );
            if ( !isset ( $_POST ['input_language'] ) ) die ( "Input language is not set!" );
            $text = $_POST ['input_contents'];
            $title = $_POST ['name'];
            $language = $_POST ['input_language'];
            $expiry = $_POST ['expiry'];

            database_connect ();
            $id = database_entries ();
            database_insert ( $id, $_POST ['input_language'], $text, $title, $_POST ['expiry'], $_POST ['privacy'], $_POST[$_SESSION['SESS_FIRST_NAME']] );
            print ( "Entry added.<br>" );
            $url  = "http://" . $_SERVER['HTTP_HOST'] . dirname ( $_SERVER['PHP_SELF'] );
            $url .= "/view.php?id=" . $id;
            print ( "Link:<br><a href=\"" . $url . "\">" . $url . "</a>" );
        ?>
    </body>
</html>
